<%@ page import="Helpers.HtmlEntities" %>
<%@ page import="JavaBean.*" %>
<%@ page import="java.util.Collection" %>
<%
	int totalAchat = 0;
%>

<%
	Collection<BeanBillet> listeBillets = (Collection<BeanBillet>)request.getAttribute("billets");
%>

<p class="title">Panier d'achats</p>

		
<form name="input" action="Panier" method="post">

		<% if ( request.getAttribute("messageErreur") != null ) { %>
			<p class="erreur"><%= HtmlEntities.encode(request.getAttribute("messageErreur").toString()) %></p>
		<% } %>

		<table class="full_body">
			<thead>
				<tr>
					<td>Titre du spectacle</td>	
					<td>Endroit</td>	
					<td>Date de pr&eacute;sentation</td>	
					<td>Nombre de billets</td>	
					<td>Prix unitaire</td>	
					<td>Montant total</td>
				</tr>
			</thead>

			<tbody>
			
				<%
				for (BeanBillet b:listeBillets)
				{	
				%>
					<tr>
		
						<td><%=b.getTitre() %></td>
		
						<td><%=b.getEmplacement() %></td>
		
						<td><%=b.getDateRepresentation() %></td>
		
						<td><input type="text" name="quantite_<%=b.getIdRepresentation() %>" value="<%= b.getQuantite() %>" size="2"></td>
		
						<td><%=b.getPrixUnitaire() %></td>
		
						<td><%=b.getPrixTotal() %></td>
						
						<% totalAchat += b.getPrixTotal(); %>
		
					</tr>
				<%
				}
				%>
				
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td>Montant total :</td>
				<td><%=totalAchat %></td>
			</tr>	
			</tbody>

		</table>

		<input type="submit" value="Actualiser les quantit&eacute;s">

		<br/>
		
	</form>
	
	<form name="input" action="Achat" method="post">
		<input type="submit" value="Proc&eacute;der au paiement">
	</form>
